package listeners;

import gui.Main;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.TooManyListenersException;

import network.Envio;
import network.Portas;

public class EnviarListener implements ActionListener {

	private Main main;

	public EnviarListener(Main main) {
		this.main = main;
	}

	public void actionPerformed(ActionEvent e) {
		Envio envio = new Envio(MenuListener.arquivoEnvio);
		try {
			Portas.getCOM1().addEventListener(envio);
		} catch (TooManyListenersException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		Portas.getCOM1().notifyOnDataAvailable(true);
		envio.start();
	}
}
